package com.fjd.service.impl;

import com.fjd.entity.DeliveryDetail;
import com.fjd.entity.DeliveryDetailHistory;
import com.fjd.mapper.DeliveryDetailHistoryMapper;
import com.fjd.mapper.DeliveryDetailMapper;
import com.fjd.mapper.TransportDetailMapper;
import com.fjd.service.DeliveryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeliveryServiceImpl implements DeliveryService {
    @Autowired
    private DeliveryDetailHistoryMapper deliveryDetailHistoryMapper;

    @Autowired
    private TransportDetailMapper transportDetailMapper;

    @Autowired
    private DeliveryDetailMapper deliveryDetailMapper;



    @Override
    public List<DeliveryDetailHistory> getDeliveryDetail(String orderId) {
        //根据订单ID查询查询tracking_number
        String trackingNumber = transportDetailMapper.getDeliveryIdByOrderId(orderId);
        //根据trackingNumber查询DeliveryBatchId
        String DeliveryBatchId = deliveryDetailMapper.getDeliveryBatchIdByTrackingNumber(trackingNumber);

        List<DeliveryDetailHistory> deliveryDetailHistoryList = deliveryDetailHistoryMapper.getByDeliveryOrderNumber(DeliveryBatchId);
        return deliveryDetailHistoryList;
    }
}
